package com.mall.commonutils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Riskre
 *配置类获取配置文件里面OSS的信息
 */
@Component
public class ConstantConfig implements InitializingBean {

    @Value("${aliyun.endpoint}")
    private String endpoint;
    @Value("${aliyun.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.accessKeySecret}")
    private String accessKeySecret;
    @Value("${aliyun.bucketName}")
    private String bucketName;
    //文件存储目录
    @Value("${aliyun.filehost}")
    private String filedir;

    public static String ALIYUN_END_POINT         ;
    public static String ALIYUN_ACCESS_KEY_ID     ;
    public static String ALIYUN_ACCESS_KEY_SECRET ;
    public static String ALIYUN_BUCKET_NAME1      ;
    public static String ALIYUN_FILE_HOST         ;

    @Override
    public void afterPropertiesSet() throws Exception {
        ALIYUN_END_POINT = endpoint ;
        ALIYUN_ACCESS_KEY_ID = accessKeyId;
        ALIYUN_ACCESS_KEY_SECRET = accessKeySecret;
        ALIYUN_FILE_HOST = filedir;
        ALIYUN_BUCKET_NAME1 = bucketName;
    }

}
